package com.ef.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.ef.dao.PayDao;
import com.ef.domain.Contract;
import com.ef.domain.PayHistory;

public class PayDaoImpl extends DaoImpl<PayHistory> implements PayDao {

	public List<PayHistory> findByContract(Contract contract) {
		DetachedCriteria criterion = DetachedCriteria
				.forClass(PayHistory.class);
		criterion.createCriteria("contract").add(
				Restrictions.eq("id", contract.getId()));
		criterion.addOrder(Order.asc("payTime"));
		return  findAllByCriteria(criterion);
 	}
}
